import request from '@/utils/request'
// import { Message } from 'element-ui'// 引入element的Message插件

// function getParam(data) {
//   let url = ''
//   for (var k in data) {
//     let value = data[k] !== undefined ? data[k] : ''
//     url += `&${k}=${encodeURIComponent(value)}`
//   }
//   return url ? url.substring(1) : ''
// }

const http = {
  get(url, params) {
    const config = {
      method: 'get',
      url: url
    }
    if (params) config.params = params

    return request(config)
  },
  post(url, params, responseType) {
    const config = {
      method: 'post',
      url: url
    }
    if (params) config.data = params
    if (responseType) config.responseType = 'blob'

    return request(config)
  }
}
// 导出
export default http
